package day6Exer;

public class Demo {
    public static void main(String[] args) {
    subCar car = new subCar();
    car.mark="小米";
    car.price=29.99;
    car.speed=100;
    car.drive();
        System.out.println("驾驶的汽车品牌为"+car.getMark()+"，它的价格为"+car.getPrice()+"，它现在的时速为"+car.getSpeed());
        car.shifting(120);
        System.out.println("变速了");
        System.out.println("驾驶的汽车品牌为"+car.getMark()+"，它的价格为"+car.getPrice()+"，它现在的时速为"+car.getSpeed());

    }
}
class Car{
    public String mark;
    public void drive(){
        System.out.println("---------------------驾驶---------------------");
    }
    public String getMark(){
        return mark;
    }
}
class subCar extends Car{
    public double price;
    public int speed;

    public void shifting(int x){
        this.speed = x;
    }
    public double getPrice(){
        return price;
    }
    public int getSpeed(){
        return speed;
    }
}
